import Versions.room_version
import org.gradle.api.JavaVersion

object BuildVersions {

    const val compileSdkVersion = 34
    const val targetSdkVersion = 34
    const val minSdkVersion = 24

    const val jvmTarget = "17"
    var javaVersion = JavaVersion.VERSION_17
    const val composeVersion = "1.4.0"

    var versionCode = 0
    var versionName = ""  // ↓↓↓ 版本改下面

    init {
        // ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓   版本改这里   ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
        versionName = "1.0.0"
        // ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑   版本改这里   ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

        val name = versionName.trim().replace("\"", "").replace("\'", "").replace(".", "")
        val len = name.length
        if (len <= 0) versionCode = 100
        versionCode = Integer.valueOf(name) + 23
    }
}

object Versions {
    val lifecycle_version = "2.6.1"
    val act_ktx_version = "1.7.2"
    val coroutine_version = "1.7.1"
    val room_version = "2.5.0"
}

object Dep {

    const val ktxCore = "androidx.core:core-ktx:1.9.0"
    const val appcompat = "androidx.appcompat:appcompat:1.6.1"
    const val material = "com.google.android.material:material:1.9.0"

    val lifeCycleArray = arrayOf(
        "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.lifecycle_version}",
        "androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle_version}"
    )

    val atyKtx = "androidx.activity:activity-ktx:${Versions.act_ktx_version}"

    val coroutineArray = arrayOf(
        "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutine_version}",
        "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutine_version}"
    )

    const val composeTest = "androidx.compose.ui:ui-test-junit4"
    const val composePlatform = "androidx.compose:compose-bom:2023.10.01"
    val composeArray = arrayOf(
        composePlatform,
        "androidx.activity:activity-compose:1.7.2",
        "androidx.compose.ui:ui-tooling",
        "androidx.compose.ui:ui-test-manifest",
        "androidx.compose.animation:animation",
        "androidx.compose.foundation:foundation",
        "androidx.compose.foundation:foundation-layout",
        "androidx.compose.material:material",
        "androidx.compose.material:material-icons-extended",
        "androidx.compose.runtime:runtime",
        "androidx.compose.runtime:runtime-livedata",
        "androidx.compose.ui:ui",
        "androidx.compose.ui:ui-util"
    )

    val room = "androidx.room:room-runtime:${Versions.room_version}"
    val roomKtx = "androidx.room:room-ktx:${Versions.room_version}"

    const val gson = "com.google.code.gson:gson:2.9.0"

    const val wSolution = "com.gitee.wongxd:sm_w_solution:new-SNAPSHOT"

    val coil = "io.coil-kt:coil:2.5.0"
    val coilCompse = "io.coil-kt:coil-compose:2.5.0"

//    const val glide = "com.github.bumptech.glide:glide:4.15.1"

    const val hutool = "cn.hutool:hutool-json:5.0.0"

    // https://github.com/json-path/JsonPath
    const val jsonPath = "com.jayway.jsonpath:json-path:2.8.0"

    // https://github.com/code4craft/xsoup
    const val xsoup = "us.codecraft:xsoup:0.3.7"

    const val jsoup = "org.jsoup:jsoup:1.16.2"

    const val tbssdk = "com.tencent.tbs:tbssdk:44286"

    val base = arrayOf(
        appcompat,
        material,
        *lifeCycleArray,
        ktxCore,
        atyKtx,
        *composeArray,
        coil,
        coilCompse,
        gson,
        wSolution,
        "com.squareup.okhttp3:okhttp:4.9.0",
        "com.squareup.okio:okio:2.9.0",
        "com.squareup.retrofit2:retrofit:2.9.0",
        "com.squareup.retrofit2:converter-gson:2.9.0",
    )

    val anpArray = arrayOf("androidx.room:room-compiler:${Versions.room_version}")

    val kaptArray = arrayOf("androidx.room:room-compiler:${Versions.room_version}")

    val kspArrray = arrayOf("androidx.room:room-compiler:${Versions.room_version}")

    val test = arrayOf(
        "junit:junit:4.13.2",
        composeTest
    )

    val androidTest = arrayOf(
        "androidx.test.ext:junit:1.1.5",
        "androidx.test.espresso:espresso-core:3.5.1"
    )
}